package com.yykj.user.center.server.schedule;

import com.yykj.user.center.server.service.patient.RegisterService;
import com.yykj.user.center.server.service.patient.RegisteredOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author chenl
 * @version 1.0
 * @date 2021/11/7 18:19
 */
@Component
@EnableScheduling   // 1.开启定时任务
@EnableAsync        // 2.开启多线程
public class RegisterOrderTask {
    @Autowired
    private RegisterService registerService;

    @Async
    @Scheduled(cron = "0 0 0 * * ?")
    public void first() throws InterruptedException {
        registerService.complete();
    }
}
